package com.bacga.abctest.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;

import java.util.Map;

public class Post extends HttpClient{

    public ResponseEntity to(String url, Object data){
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.parseMediaType("application/json; charset=UTF-8"));
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        return restTemplate.postForEntity(url,data,String.class);
    }

    public ResponseEntity to(String url){
        return restTemplate.postForEntity(url,null,String.class);
    }
}
